package com.lintesis.lintesisview.webgui.personas.tutor;

import org.zkoss.zkplus.databind.BindingListModel;
import org.zkoss.zkplus.databind.BindingListModelList;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Textbox;

import com.lintesis.lintesismodel.common.Type;
import com.lintesis.lintesismodel.common.hibernate.GenericDAO;
import com.lintesis.lintesismodel.personas.Tutor;
import com.lintesis.lintesisview.common.ABMDialogCtrl;
import com.lintesis.lintesisview.common.menu.UserWorkspace;

public class TutorDialogCtrl extends ABMDialogCtrl<Tutor>{

	private static final long serialVersionUID = 4447387079525811480L;
	
	static final String rightPreffix = "tutor.dialog.";
	
	Textbox tbApellido;
	Textbox tbNombre;
	Combobox cbTipoDocumento;
	Intbox tbNroDocumento;
	Combobox cbSexo;
	Datebox tbFechaNacimiento;
	Textbox tbDomicilio;
	Textbox tbTelefono;
	Textbox tbEMail;
	Textbox tbParentesco;
	
	BindingListModel lmTipoDocumento;
	BindingListModel lmSexo;


	@Override
	protected void doSetClearComponents() {
		clearComponents.add(tbApellido);
		clearComponents.add(tbNombre);
		clearComponents.add(cbTipoDocumento);
		clearComponents.add(tbNroDocumento);
		clearComponents.add(cbSexo);
		clearComponents.add(tbFechaNacimiento);
		clearComponents.add(tbDomicilio);
		clearComponents.add(tbTelefono);
		clearComponents.add(tbEMail);
		clearComponents.add(tbParentesco);
	}

	@Override
	protected void doSetFieldProperties() {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void doSetReadOnlyComponents() throws Exception {
		roComponents.addAll(clearComponents);
	}

	@Override
	protected void doSetValidation() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void fillBussinesObject() throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	protected void fillComboBoxs() throws Exception {
		try
		{
			lmTipoDocumento = new BindingListModelList(new GenericDAO<Type>(UserWorkspace.getInstance().gethSession()).getByBussinessObject(new Type()), true);
		} catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try
		{
			lmSexo = new BindingListModelList(new GenericDAO<Type>(UserWorkspace.getInstance().gethSession()).getByBussinessObject(new Type()), true);
		} catch (Exception e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public String getEntityName() {
		return "Tutor";
	}

	@Override
	protected Tutor getNewEntidad() {
		Tutor tutor=new Tutor();
		return tutor;
	}

	@Override
	protected String getRightPreffix() {
		return rightPreffix;
	}

}
